#include "../../Base/StdAfx.h"
#include "IniFile.h"

IniFile::IniFile(void)
{
}

IniFile::~IniFile(void)
{
	map<tstring,IniSection*>::iterator it;
	for ( it = m_IniSectionMap.begin();
		it != m_IniSectionMap.end();
		it++ )
	{
		delete (*it).second;
	}

	
}


void IniFile::AddIniSection(IniSection* iniSection)
{
	m_IniSectionMap[iniSection->GetSectionName()]=iniSection;
}

tstring IniFile::GetValue(const tstring& sectionName, const tstring& keyName)
{
	if ( m_IniSectionMap.find(sectionName) != m_IniSectionMap.end()){
		IniSection* section = m_IniSectionMap[sectionName];
		return section->GetValue(keyName);
	}else
		return _T("");
}